package com.ssm.controller;

import com.ssm.service.RealNumberService;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RequestMapping(value = "realNumber")
@Controller
@CrossOrigin
public class RealNumberController {

    @Autowired
    public RealNumberService realNumberService;
    public void setRealNumberService(RealNumberService realNumberService) {
        this.realNumberService = realNumberService;
    }
    @ResponseBody
    @RequestMapping(value = "is_att")
    public JSON realNumberList(@RequestParam("address") String address){
        int realNumber = this.realNumberService.countRealNum(address);
//        List<Integer> realNumbers = new ArrayList<Integer>();
//        realNumbers.add(realNumber);

        Map map = new HashMap();
        map.put("realNumber",realNumber);
        JSONObject jsonObject = JSONObject.fromObject(map);
        return jsonObject;
    }
}
